import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import dayjs from 'dayjs';

//查询参数
export const queryFormSchema: FormSchema[] = [
  {
    label: '订单时间',
    field: 'orderDate',
    component: 'RangePicker',
    defaultValue: [dayjs().startOf('month'), dayjs()],
    componentProps: {
      //日期格式化
      format: 'YYYY-MM-DD',
      //范围文本描述用集合
      placeholder: ['请选择起始时间', '请选择结束时间'],
      presets: [
        { label: '近三天', value: [dayjs().add(-3, 'd'), dayjs()] },
        { label: '近七天', value: [dayjs().add(-7, 'd'), dayjs()] },
        { label: '本周', value: [dayjs().startOf('week'), dayjs()] },
        { label: '上周', value: [dayjs().subtract(1, 'week').startOf('week'), dayjs().subtract(1, 'week').endOf('week')] },
        { label: '本月', value: [dayjs().startOf('month'), dayjs()] },
        { label: '上月', value: [dayjs().subtract(1, 'month').startOf('month'), dayjs().subtract(1, 'month').endOf('month')] },
      ],
    },
  },
  {
    label: '系统渠道',
    field: 'customerTypeCode',
    component: 'JSearchSelect',
    componentProps:{
       dict:"xl_customer_type,type_desc,type_code"
    },
  },
  {
    label: '城市',
    field: 'city',
    component: 'Input',
  },
  {
    label: '门店',
    field: 'storeCode',
    component: 'JSearchSelect',
    componentProps:{
       dict:"xl_customer_store_info where is_deleted = '0',store_name,store_code"
    },
  },
];

//门店销售列表
export const storeColumns: BasicColumn[] = [
  {
    title: '序号',
    align: 'center',
    dataIndex: 'sort',
  },
  {
    title: '门店名称',
    align: 'center',
    dataIndex: 'storeName',
  },
  {
    title: '订单金额',
    align: 'center',
    dataIndex: 'amount',
  },
  {
    title: '订单数量',
    align: 'center',
    dataIndex: 'cnt',
  },
  {
    title: '未支付订单数',
    align: 'center',
    dataIndex: 'unPayCnt',
  },
];

//商品排名列表
export const productColumns: BasicColumn[] = [
  {
    title: 'upc',
    align: 'center',
    dataIndex: 'upc',
    width: 120,
  },
  {
    title: '商品名称',
    align: 'center',
    dataIndex: 'productName',
  },
  {
    title: '订单数量',
    align: 'center',
    dataIndex: 'cnt',
    width: 80,
  },
  {
    title: '成交金额',
    align: 'center',
    dataIndex: 'amount',
    width: 80,
  },
  {
    title: '售后数量',
    align: 'center',
    dataIndex: 'aftersaleCnt',
    width: 80,
  },
  {
    title: '周同比',
    align: 'center',
    dataIndex: 'weekRatio',
    width: 80,
  },
];

//售后种类列表
export const aftersaleTypeColumns: BasicColumn[] = [
  {
    title: '售后种类',
    align: 'center',
    dataIndex: 'aftersaleType',
  },
  {
    title: '售后单数',
    align: 'center',
    dataIndex: 'aftersaleCnt',
  },
  {
    title: 'SKU总数',
    align: 'center',
    dataIndex: 'skuSum',
  },
  {
    title: '售后金额',
    align: 'center',
    dataIndex: 'aftersaleAmount',
  },
];

//售后商品列表
export const aftersaleColumns: BasicColumn[] = [
  {
    title: 'upc',
    align: 'center',
    dataIndex: 'upc',
    width: 120,
  },
  {
    title: '商品名称',
    align: 'center',
    dataIndex: 'productName',
    width: 260,
  },
  {
    title: '售后原因',
    align: 'center',
    dataIndex: 'renson',
    width: 80,
  },
  {
    title: '售后数量',
    align: 'center',
    dataIndex: 'aftersaleQuantity',
    width: 80,
  },
  {
    title: '售后金额',
    align: 'center',
    dataIndex: 'aftersaleAmount',
    width: 80,
  },
];
